#include <algorithm>
#include <iostream>
#include <string>

#include "Vector.h"

using namespace std;

// class Vector {
//    public:
//     Vector() {
//         name = "";
//         dimension = 0;
//     }
//     Vector(string, int, int[]);
//     Vector(const Vector &otherVec) {
//         name = otherVec.name;
//         dimension = otherVec.dimension;
//         for (int i = 0; i < dimension; i++)
//             param[i] = otherVec.param[i];
//         cout << "copy a vector called " << name << ".\n";
//     }
//     ~Vector();
//     void isEqual(const Vector &);
//     void setName(string);
//     void Print();

//    private:
//     string name;
//     int dimension;
//     int param[50];
// };

Vector::Vector(string s, int d, int n[]) {
    name = s;
    dimension = d;
    for (int i = 0; i < d; i++) param[i] = n[i];
    cout << "construct a vector called " << name << ".\n";
}

Vector::~Vector() {
    cout << "release memory from a vector called " << name << ".\n";
}

void Vector::isEqual(const Vector &v) {
    if (name == v.name)
        cout << "same name, ";
    else
        cout << "different name, ";

    if (dimension != v.dimension) {
        cout << "different value.\n";
        return;
    } else {
        for (int i = 0; i < dimension; i++) {
            if (param[i] != v.param[i]) {
                cout << "different value.\n";
                return;
            }
        }
        cout << "same value.\n";
        return;
    }
}

void Vector::setName(string s) {
    name = s;
}

void Vector::Print() {
    cout << name << "(";
    for (int i = 0; i < dimension; i++) cout << param[i] << (i == dimension - 1 ? "" : ", ");
    cout << ")\n";
}
